<?php

namespace App\Http\Requests\Api;

class CompanyInfoRequest extends ApiRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'id' => 'bail|required|integer',
            'company_name'=>'required',
            'industry'=>'bail|required|integer',
            'comkind'=>'bail|required|integer',
            'established'=>'bail|required|before:now',
            'employee_num'=>'bail|required|integer|min:1',
            'profile'=>'bail|required|min:3',
        ];
    }

    public function attributes()
    {
        return [
            'company_name'=>'公司名称',
            'industry'=>'所属行业',
            'comkind'=>'公司性质',
            'established'=>'成立年份',
            'employee_num'=>'员工数量',
            'profile'=>'公司简介',
        ];
    }

    public function messages()
    {
        return array_merge(parent::messages(),[
            'profile.min'=>':attribute不能小于:min个字',
            'established.before'=>':attribute不能小于现在'
        ]);
    }
}
